import Opt from '@/components/dt/info/Opt.js'
import dateOpt from '@/biz/option/date.js'
let _this = null
class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    // 活动信息
    let activityArr = [
      {
        title: '奖品名称',
        field: 'prizeName',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '现金金额',
        field: 'unitPrice',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '总数',
        field: 'lotteryCount',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '已中奖数',
        field: 'prizes',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '剩余奖品数',
        field: 'remainingPrize',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '今日中奖数',
        field: 'todayPrizes',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '状态',
        field: 'lotteryStatusStr',
        minWidth: 100,
        align: 'center'
      }
    ]
    let sameArr = [
      {
        title: '序号',
        type: 'index',
        width: 80,
        align: 'center'
      },
      {
        title: '所属组织',
        field: 'orgName',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '案场名称',
        field: 'housesName',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '工号',
        field: 'workNo',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '姓名',
        field: 'userName',
        minWidth: 120,
        align: 'center'
      }
    ]
    // 参与用户
    let userArr = [
      {
        title: '首次抽奖时间',
        field: 'firstParticipationTime',
        minWidth: 180,
        align: 'center'
      },
      {
        title: '抽奖次数',
        field: 'participationCount',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '是否中奖',
        field: 'lotteryStatus',
        minWidth: 120,
        align: 'center'
      }
    ]
    // 中奖信息
    let prizeArr = [
      {
        title: '中奖时间',
        field: 'lotteryTime',
        minWidth: 180,
        align: 'center',
        header: {
          filter: dateOpt.range({
            title: '中奖时间',
            startKey: 'lotteryStartTime',
            endKey: 'lotteryEndTime'
          })
        }
      },
      {
        title: '奖品名称',
        field: 'prizeName',
        minWidth: 120,
        align: 'center'
      },
      {
        title: '现金金额',
        field: 'unitPrice',
        minWidth: 120,
        align: 'center'
      }
    ]
    // 钱包报表
    let reportArr = [
      {
        title: '钱包余额(元)',
        field: 'balance',
        minWidth: 150,
        align: 'center'
      },
      {
        title: '已提金额(元)',
        field: 'withdrawAmount',
        minWidth: 150,
        align: 'center'
      }
    ]
    // 提现流水
    let waterArr = [
      {
        title: '提现金额(元)',
        field: 'withdrawnAmount',
        minWidth: 150,
        align: 'center'
      },
      {
        title: '操作时间',
        field: 'createTime',
        minWidth: 180,
        align: 'center',
        header: {
          filter: dateOpt.range({
            title: '操作时间',
            startKey: 'startTime',
            endKey: 'endTime'
          })
        }
      }
    ]
    // 钱包统计
    let countArr = [
      {
        title: '钱包进账(元)',
        field: 'incomeAmount',
        minWidth: 150,
        align: 'center'
      },
      {
        title: '钱包提现(元)',
        field: 'withdrawMoneyAmount',
        minWidth: 150,
        align: 'center'
      }
    ]

    if (_this.tabsVal == '1') {
      this.all = [...activityArr]
    } else if (_this.tabsVal == '2') {
      this.all = [...sameArr, ...userArr]
    } else if (_this.tabsVal == '3') {
      this.all = [...sameArr, ...prizeArr]
    } else if (_this.tabsVal == '4') {
      this.all = [...sameArr, ...reportArr]
    } else if (_this.tabsVal == '5') {
      this.all = [...sameArr, ...waterArr]
    } else if (_this.tabsVal == '6') {
      this.all = [...sameArr, ...countArr]
    }
  }
}

export default Column
